<?
require_once("../config/dbconn.php");require_once("../config/usercls.php");

//获取会员的信息
$sqlhy="select username,price,gwprice,gpprice,jjprice,mbprice,isdp,bduser from {$db_prefix}users where id='".$_SESSION['sys_userid']."'";//1
$rshy=$db->get_one($sqlhy);
//检测是否是在服务中心推荐
if($rshy["isdp"]==1){
	$fwzx = $rshy["username"];
}else{
	$fwzx=$rshy["bduser"];
}
	$myname = $rshy["username"];
	$userlist=$rshy["username"];
	$userarr=split(',',$userlist);
	$ceng=0;
	while($userlist!=null&&$userlist!="")
	{	
/*		echo "<script>alert('$ceng');</script>";	
*/		$i=0;
		foreach($userarr  as $k2=>$gluser)		
		{
/*			echo "<script>alert('$gluser');</script>";
*/			$strlf="select username from {$db_prefix}users where gluser='$gluser' and pos=1";
			$rs=$db->get_one($strlf);
			if($rs!=null)
			{
				if($i==0) $userlist=$rs["username"];
				else $userlist=$userlist.",".$rs["username"];
			}else{
				$pos=1;$userlist="";
/*				echo "<script>alert('aaa');</script>";
*/				break;
			}
/*			echo "<script>alert('$userlist');</script>";
*/			$i++;
			$strlf="select username from {$db_prefix}users where gluser='$gluser' and pos=2";
			$rs=$db->get_one($strlf);
			if($rs!=null)
			{
				$userlist=$userlist.",".$rs["username"];
			}else{
				$pos=2;$userlist="";
/*				echo "<script>alert('bbb');</script>";
*/				break;
			}
/*			echo "<script>alert('$userlist');</script>";
*/			$i++;
		}
		$userarr=split(',',$userlist);
		$ceng++;
	}
/*	echo "<script>alert('$gluser');</script>";
	echo "<script>alert('$pos');</script>";
	echo "<script>alert('22');</script>";*/

//是不是第一个会员
$isdyhy=0;
$sqldy="select id from {$db_prefix}users where 1 order by id asc limit 1";
$rsdy=$db->get_one($sqldy);
$price1 = $rshy["mbprice"];
if (!$rsdy['id']) $isdyhy=1;

if($act=='reg'){
	$msg='';
	$bduser=$fwzx;
	/*if(trim($idcard)==''){
			echo "<script>alert('身份证信息不能为空！');history.back();</script>";exit();
	}*/
	if (trim($idcard)!='')
	{

		$vCity = array(
			'11','12','13','14','15','21','22',
			'23','31','32','33','34','35','36',
			'37','41','42','43','44','45','46',
			'50','51','52','53','54','61','62',
			'63','64','65','71','81','82','91'
		);
	/*	if(!preg_match('/(^[0-9]{15}$)|(^[0-9]{17}([0-9]|X|x)$)/',$idcard)){
			echo "<script>alert('身份证信息错误');history.back();</script>";exit();
    }*/
	/*	if(!in_array(substr($idcard,0,2),$vCity)){
			echo "<script>alert('身份证信息错误');history.back();</script>";exit();
    }*/
		$idcard = preg_replace('/[xX]$/i', 'a', $idcard);
		
		$vLength = strlen($idcard);
		if ($vLength==18)
		{
			$vSum = 0;
			for ($i = 17;$i>=0;$i--)
			{
				$vSubStr=substr($idcard,17-$i,1);
				$vSum += (pow(2,$i)%11)*(($vSubStr =='a')?10:intval($vSubStr,11));
			}
		/*	if($vSum%11!=1)
			{
			echo "<script>alert('身份证信息错误');history.back();</script>";exit();
            }*/
        }
		//检测数据库中是否存在相同身份证
		/*$sqlcard="select * from {$db_prefix}users where idcard='".trim($idcard)."'";
		$rscard=$db->get_one($sqlcard);
		$idcardin = $rscard["idcard"];
		if(strcasecmp(strtolower($idcardin),strtolower($idcard)) == 0){
			echo "<script>alert('该身份证已经注册！');history.back();</script>";exit();
        }*///结束
}		
	if(trim($pwd)==''){
		$pwd="111111";$repwd=$pwd;
	}
	if(trim($pwd1)==''){
		$pwd1="222222";$repwd1=$pwd1;
	}
	if(trim($username)=='') $msg.="请输入用户名\\n";
	else{
		$userpreg="/^[a-zA-Z0-9]{6,}$/";
		if (!preg_match($userpreg,trim($username))){
			 $msg.="用户名必须是数字和字母的组合。且不能少于6位 \\n";
		}
	}
	//if(trim($nickname)=='') $msg.="请输入姓名\\n";
	if(trim($pwd)=='') $msg.="请输入登陆密码\\n";
	if(trim($repwd)=='') $msg.="请确认登陆密码\\n";
	if (trim($pwd)!=trim($repwd)) $msg.="二次登陆密码不一致\\n";
	if(trim($pwd1)=='') $msg.="请输入二级密码\\n";
	if(trim($repwd1)=='') $msg.="请确认二级密码\\n";
	if (trim($pwd1)!=trim($repwd1)) $msg.="二次二级密码不一致\\n";
	if(trim($rank0)=='') $msg.="请选择会员级别\\n";
	if ($isdyhy==0){
		if(trim($tjuser)=='') $msg.="请输入推荐用户\\n";
	//	if(trim($gluser)=='') $msg="请输入管理用户\\n";
	//	if(trim($pos)=='') $msg="请选择区位\\n";
	if(trim($fwzx)=='') $msg="请输入服务中心\\n";
	}
    $regpv=0;//报单业绩
    $regnum=0;
	$regmoney=0;//报单金额
	$gpprice=0;//配股
	$gpnum=0;//配股
	$regstate=0;$confirmtime=0;
	
	$glornamejj="glo_regprice_".$rank0;
	$regmoney=$$glornamejj;
    /*   echo "<script>alert('$regmoney');</script>";exit();*/
    $glornamepv="glo_regpv_".$rank0;
    
    $regpv=$$glornamepv; 
    
	$glornamepv="glo_regnum_".$rank0;
	$regnum=$$glornamepv; 
	$glornamerate="glo_lcrate_".$rank0;
	$gpprice=$$glornamerate;//报单单数//1
	$glornamenum="glo_peigu_".$rank0;
	$gpnum=$$glornamenum;//报单单数
	echo "<script>alert('$price1');</script>";
	echo "<script>alert('$regpv');</script>";
	if($price1<$regpv){		
		echo "<script>alert('复投币不足');history.back();</script>";exit();
	}
	if(trim($agree)!=1) $msg.="请阅读并同意注册协议\\n";
	if ($msg!=''){
		echo "<script>alert('$msg');history.back();</script>";exit();
	}
	
	//身份证最多试用2次
	/*$sqlid="select count(id) as c from {$db_prefix}users where idcard='".trim($idcard)."'";
	$rsid=$db->get_one($sqlid);
	if ($rsid['c']>=2){
		$msg.="一个身份证最多使用2次\\n";
    }*/
	
	//检测用户名是否可以使用
	$sqlchk="select id from {$db_prefix}users where username='".trim($username)."'";
	$rschk=$db->get_one($sqlchk);
	if ($rschk['id']) $msg.="用户名已经被占用\\n";
	if ($msg!=''){
		echo "<script>alert('$msg');history.back();</script>";exit();
	}
	
	
	//检测管理人是否存在
	if ($isdyhy==0)
	{
		$sqlchk2="select id,glstr,gldepth from {$db_prefix}users where username='".trim($gluser)."'";
		$rschk2=$db->get_one($sqlchk2);
		if (!$rschk2['id']) $msg.="管理用户不存在\\n";
		if ($msg!=''){
			echo "<script>alert('$msg');history.back();</script>";exit();
		}
		$gluserid=$rschk2['id'];
		//检测区位
		$sqlchk3="select id from {$db_prefix}users where gluser='".trim($gluser)."' and pos='$pos'";
		$rschk3=$db->get_one($sqlchk3);
		if ($rschk3['id']) $msg.="区位已经被占用\\n";
		if ($msg!=''){
			echo "<script>alert('$msg');history.back();</script>";exit();
		}
		//所属服务中心
		if(trim($fwzx)){
			$sqlchk4="select id from {$db_prefix}users where username='".trim($fwzx)."' and zmdrank=1";
			$rschk4=$db->get_one($sqlchk4);
			if (!$rschk4['id']) $msg.="报单会员不存在\\n";
			if ($msg!=''){
				echo "<script>alert('$msg');history.back();</script>";exit();
			}
		}
	}
	

	//检测推荐人是否存在
	if ($isdyhy==0){
		$sqlchk1="select id from {$db_prefix}users where username='".trim($tjuser)."' and state=1";
		$rschk1=$db->get_one($sqlchk1);
		if (!$rschk1['id']) $msg.="推荐用户不存在\\n";
		if ($msg!=''){
			echo "<script>alert('$msg');history.back();</script>";exit();
		}
		$tjuserid=$rschk1['id'];
		//检测是否还可以分红
		if ($sqlchk1['fhstata']==1) $msg.="推荐用户日分红结束，不能推荐\\n";
		if ($msg!=''){
			echo "<script>alert('$msg');history.back();</script>";exit();
		}
		//这是会员推荐的第几个会员  11.15
		$sqltjs="select count(id) as c from {$db_prefix}users where tjuser='".trim($tjuser)."' and state=1";
		$rstjs=$db->get_one($sqltjs);
		$tjsnum=intval($rstjs['c'])+1;	

	}	
	//更新推荐人信息
	unset($dataArray1);	
	$dataArray1['tjnum']=$tjsnum;		
	//推荐9人自动升为服务中心
	/*if($tjsnum==9)
	{   $dataArray1['isdp']=1;}*/
	$db->update("{$db_prefix}users",$dataArray1,"username='".trim($tjuser)."'");
	
	
	

	$regstate=1;$confirmtime=$curtime;
    //扣除报单币
/*  echo"<script>alert($regpv);</script>";
*/    $dataArray['mbprice']=$rshy['mbprice']-$regpv;
/*    echo"<script>alert($regpv);</script>";
*/	//$dataArray['gpprice']=$rshy['gpprice']-$restprice;
	$condition="id='".$_SESSION['sys_userid']."'";
	$db->update("{$db_prefix}users",$dataArray,$condition);

	//财务记录
	$e_userid=$_SESSION['sys_userid'];$e_price=-$regpv;$e_type=1;$e_ptype=7;$e_addtime=$curtime;$e_memo="注册会员{$username}，复投币";
    hyepricejl($e_userid,$e_price,$e_type,$e_ptype,$e_addtime,$e_memo);
    //积分财务记录
	/*$e_userid=$_SESSION['sys_userid'];$e_price=$regmoney;$e_type=2;$e_ptype=6;$e_addtime=$curtime;$e_memo="注册会员{$username}，兑换积分";
	hyepricejl($e_userid,$e_price,$e_type,$e_ptype,$e_addtime,$e_memo);*/
	//财务记录
	/*$e_userid=$_SESSION['sys_userid'];$e_price=-$restprice;$e_type=1;$e_ptype=4;$e_addtime=$curtime;$e_memo="注册会员{$username}，激活币";
	hyepricejl($e_userid,$e_price,$e_type,$e_ptype,$e_addtime,$e_memo);*/
	
	$gldepth=0;$tjdepth=0;$isdp=0;$tjstr='';$glstr='';
	if ($isdyhy==0){
		$gldepth=$rschk2['gldepth']+1;
		$tjdepth=$rschk1['tjdepth']+1;
		//推荐关系
		$sqltjgx="select userid,tjstr from {$db_prefix}tjgx where userid='".$rschk1['id']."'";
		$rstjgx=$db->get_one($sqltjgx);
		if ($rstjgx['tjstr']) $tjstr=$rstjgx['tjstr'].",".$rstjgx['userid'];else $tjstr=$rstjgx['userid'];
		//管理关系
		//$sqlglgx="select userid,glstr from {$db_prefix}glgx where userid='".$rschk2['id']."'";
		//$rsglgx=$db->get_one($sqlglgx);
		if ($rschk2['glstr']) $glstr=$rschk2['glstr'].",".$rschk2['id'];else $glstr=$rschk2['id'];
		if ($rschk1['tjstr']) $tjstr=$rschk1['tjstr'].",".$rschk1['id'];else $tjstr=$rschk1['id'];
		
	}
	//是否店铺
	$isdp=$hyrankdpary[$rank0];
	
	//插入到数据库
	unset($dataArray);
	$dataArray['username']=trim($username);
	$dataArray['nickname']=trim($nickname);
	$dataArray['pwd']=authcode($pwd,'ENCODE');
	$dataArray['pwd1']=authcode($pwd1,'ENCODE');
	$dataArray['rankreg']=$rank0;
	$dataArray['rank']=$rank0;
	$dataArray['tjuser']=trim($tjuser);
	$dataArray['gluser']=trim($gluser);
	$dataArray['pos']=$pos;
	$dataArray['posnum']=$sysposnum;
	$dataArray['regtime']=$curtime;
	$dataArray['confirmtime']=$confirmtime;
    $dataArray['regmoney']=$regpv;
	$dataArray['regpv']=$regpv;
	$dataArray['gcprice']=$regmoney;  //赠送积
	$dataArray['regnum']=$regnum;
	$dataArray['price']=0;
	$dataArray['gwprice']=0;
	$dataArray['jjprice']=0;
	$dataArray['gpprice']=$gpprice;//1
	$dataArray['gpnum']=$gpnum;
	$dataArray['qq']=trim($qq);
	$dataArray['mobile']=trim($mobile);
	$dataArray['address']=trim($address);
	$dataArray['email']=trim($email);
	$dataArray['province']=trim($province);
	$dataArray['city']=trim($city);
	$dataArray['area']=trim($area);
	$dataArray['sex']=trim($sex);
	$dataArray['iskong']=trim($iskong);
	$dataArray['bduser']=trim($bduser);
	$dataArray['bank']=trim($bank);
	$dataArray['bankaddress']=trim($bankaddress);
	$dataArray['bankname']=trim($bankname);
	$dataArray['bankno']=trim($bankno);
	$dataArray['isdp']=$isdp;
	$dataArray['tjdepth']=$tjdepth;
	$dataArray['gldepth']=$gldepth;
	$dataArray['state']=$regstate;
	$dataArray['idcard']=trim($idcard);
	$dataArray['regbyuser']=$_SESSION["sys_username"];
	$dataArray['regbytype']=1;
	$dataArray['glstr']=$glstr;
	$dataArray['tjstr']=$tjstr;//11.15
//	$dataArray['djdate']=$curtime;
	$dataArray['tjnum']=0;
	//静态奖	
	$times=1;
	$dataArray['ft_times']=trim($times);
	$dataArray['ft_backnumber']=0;
	$dataArray['ft_startdate']=$curtime;;
	$dataArray['ft_enddate']=$curtime+3600*24*150;
	$dataArray['ft_number']=150;
	$dataArray['ft_thisdate']=$curtime;
	$dataArray['ft_nextdate']=$curtime+3600*24*1;
	$dataArray['ft_summoney']=0;
	$dataArray['ft_realmoney']=0;
//	$dataArray['ft_bdsummoney']=0;
//	$dataArray['ft_tzsummoney']=0;
//	$dataArray['ft_xjsummoney']=0;
	$dataArray['ft_isend']=1;
	$dataArray['hlprice']=0;
	$dataArray['mbprice']=0;
	$dataArray['islock']=1;
	$dataArray['autotx']=0;
	$db->insert("{$db_prefix}users",$dataArray);
	$newuserid=$db->insert_id();
	
	
	
	//把推荐关系更新到数据库
	unset($dataArray);
	$dataArray['userid']=$newuserid;
	$dataArray['tjstr']=$tjstr;
	$db->insert("{$db_prefix}tjgx",$dataArray);
	//把管理关系更新到数据库
	unset($dataArray);
	$dataArray['userid']=$newuserid;
	$dataArray['glstr']=$glstr;
	$db->insert("{$db_prefix}glgx",$dataArray);
	
	require("../entera.php");
//	require("../enterc.php");
//	require("../backmoney2.php");
	
	
	echo "<script>alert('会员注册成功');location.href='user_tj1.php';</script>";exit();
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
		background-image: url(image1/bg-body.png);
}
.red{
	color:red
}
td{
	font-size:12px;
}
-->
</style>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/utils.js"></script>
<script type="text/javascript" src="js/user_reg.js"></script>
<link href="images/skin.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="17" height="29" valign="top" background="images/mail_leftbg1.png"><img src="images/left-top-right1.png" width="17" height="29" /></td>
    <td width="935" height="29" valign="top" background="images/content-bg.gif"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
      <tr>
        <td height="31"><div class="titlebt">会员注册/Join</div></td>
      </tr>
    </table></td>
    <td width="16" valign="top" background="images/mail_rightbg.png"><img src="images/nav-right-bg.png" width="16" height="29" /></td>
  </tr>
  <tr>
    <td height="71" valign="middle" background="images/mail_leftbg1.png">&nbsp;</td>
    <td valign="top" bgcolor="#F7F8F9"><table width="100%" height="138" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="13" valign="top">&nbsp;</td>
      </tr>
      <tr>
         <td valign="top">
		<form id="form1" name="form1" method="post" action="?act=reg" onSubmit="return userregdo(this);">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td height="30" colspan="3">		  
			  <table width="100%" border="0" cellpadding="0" cellspacing="0">
               <tr>
                  <td height="30" align="center" bgcolor="#f2f2f2" class="left_txt">                    用户名</td>
                  <td width="83%" height="30" bgcolor="#f2f2f2" class="left_txt">
				  <? //系统是否自动产生编号
				  if ($glo_autohybh==1){				  	
				  	$curhybh='';					
					function hybhchkf(){
						global $db,$db_prefix,$glo_autohypre,$curhybh;
						$hyautobh=$glo_autohypre.rand(111111,999999);
						$sqlf="select id from {$db_prefix}users where username='$hyautobh'";
						$rsf=$db->get_one($sqlf);
						if ($rsf['id']){
							hybhchkf();
						}else{
							$curhybh=$hyautobh;
						}
					}
					hybhchkf();
				  }
				  ?>
				  <label>
                    <input name="username" type="text" id="username" onBlur="usernamefocus();" value="<?=$curhybh?>">
                    <span class="red">*</span></label> <label id="username_notice" class="red"></label></td>
                </tr>
                <tr>
                  <td height="30" align="center" class="left_txt">姓名</td>
                  <td height="30" class="left_txt"><label>
                    <input name="nickname" type="text" id="nickname">
                    <span class="red">*</span></label></td>
                </tr>
                <tr>
                  <td height="30" align="center" bgcolor="#f2f2f2" class="left_txt">性别</td>
                  <td height="30" bgcolor="#f2f2f2" class="left_txt"><label>
                    <select name="sex" id="sex">
					<option value="男">男/Male</option>
					<option value="女">女/Female</option>
                    </select>
                  </label></td>
                </tr>
                <tr>
                  <td height="30" align="center" class="left_txt">登陆密码</td>
                  <td height="30" class="left_txt"><label>
                    <input name="pwd" type="password" id="pwd">
                    <span class="red">*不填写，默认密码是111111                    </span></label></td>
                </tr>
                <tr>
                  <td height="30" align="center" bgcolor="#f2f2f2" class="left_txt">确认登陆密码</td>
                  <td height="30" bgcolor="#f2f2f2" class="left_txt"><input name="repwd" type="password" id="repwd">
                    <span class="red">*</span></td>
                </tr>
                <tr>
                  <td height="30" align="center" class="left_txt">二级密码</td>
                  <td height="30" class="left_txt"><input name="pwd1" type="password" id="pwd1">
                    <span class="red">*不填写，默认密码是222222                    </span></td>
                </tr>
                <tr>
                  <td height="30" align="center" bgcolor="#f2f2f2" class="left_txt">确认二级密码</td>
                  <td height="30" bgcolor="#f2f2f2" class="left_txt"><label>
                    <input name="repwd1" type="password" id="repwd1">
                    <span class="red">*</span></label></td>
                </tr>
				   <tr>
				     <td height="30" align="center" bgcolor="#f2f2f2" class="left_txt">注册级别</td>
				     <td height="30" bgcolor="#f2f2f2" class="left_txt"><select name="rank0" id="rank0" onChange="rankchange(this.value)">
                       <?
				  foreach($hyrankary as $k1=>$v1){
				 	 echo "<option value='{$k1}'";
				  	/*$glorname="glo_regprice_{$k1}";
					if ($allprice>=$$glorname){
						echo " selected";
					}*/
				  	echo ">{$v1}</option>";
				  }
				  ?>
                     </select>
                       <span class="red">*&nbsp;
					    <?
				  foreach($hyrankary as $k1=>$v1){
				  	$glornamejj="glo_regprice_{$k1}";
				 	 ?>
					 <input name="regprice_<?=$k1?>" type="hidden" value="<?=$$glornamejj?>">
					 <?
				  }
				  ?>
                       <input type="hidden" name="hyregprice" value="<?=$glo_regprice_1?>">
                       </span></td>
				     </tr>
				   <tr style="display:none">
				     <td height="30" align="center" bgcolor="#f2f2f2" class="left_txt">注册类型</td>
				     <td height="30" bgcolor="#f2f2f2" class="left_txt"><label>
				       <select name="iskong" id="iskong">
					   <option value="0">实单</option>
                       <!--
					   <option value="1">空单/Empty single</option>
                       -->
				         </select>
				     </label>
				       <span class="red">*</span></td>
				     </tr>
                    <!-- <tr>
                              <td height="30" align="center" class="left_txt">使用报单币</td>
                              <td height="30" class="left_txt"><label>
                                <input name="price" type="text" id="price" size="10" value="<?=$rs['price']?>">
                                 <span class="red">*</span>注册使用报单币<?=$glo_bdneed?></label></td>
                            </tr>-->
				 <?
				  if ($isdyhy==0){
				  ?>
				   <tr>
				     <td height="30" align="center" class="left_txt"><p >推荐用户</p></td>
				 <?
				  if (!$rs){
				  ?>
				     <td height="30" class="left_txt"><label>
				       <input name="tjuser" type="text" id="tjuser" onBlur="tjuserfocus();" value="<?=$myname?>">
				       <span class="red">*</span></label> <label class="red" id="tjuser_notice"></label></td>
				  <?
						}
				  ?>
				   <?
				  if ($rs){
				  ?>
				     <td height="30" class="left_txt">  <span class="red">*</span>
					 <input type="hidden" name="tjuser" id="tjuser" value="<?=$myname?>" ><?=$myname?>
				     </td>
				  <?
						}
				  ?>
				     </tr>

					 
					 
					 
				   <tr style="display:">
				     <td height="30" align="center" bgcolor="#f2f2f2" class="left_txt"><p >接点用户/Contact users</p></td>
				     <td height="30" bgcolor="#f2f2f2" class="left_txt"><label>
				     <? //最后注册的用户
				    	//$gluser='';
						//global $db,$db_prefix,$glo_autohypre,$curhybh;
						//$sqlf="select id,username from {$db_prefix}users order by id desc";
						//$rsf=$db->get_one($sqlf);
						//$gluser=$rsf['username'];
					 ?>
                     <label>
				       <input name="gluser" type="text" id="gluser" onBlur="gluserfocus();" value="<?=$gluser?>" >
				       <span class="red">*</span></label> <label class="red" id="gluser_notice"></label></td>
				     </tr>
				   <tr style="display:">
				     <td height="30" align="center" class="left_txt">位置/Location</td>
				     <td height="30" class="left_txt"><label>
				       <select name="pos" id="pos" onChange="posfocus();">
					   <option value="">请选择</option>
					   <?
					    foreach($sysposary as $k1=>$v1){
							echo "<option value='{$k1}'";
							if ($pos==$k1) echo " selected";
							echo ">{$v1}</option>";
						  }
					   ?>
				       </select>
				       <span class="red">*</span></label> <label class="red" id="pos_notice"></label></td>
				     </tr>			
					<tr>
                              <td height="30" align="center" class="left_txt">所属服务中心</td>
                              <td height="30" class="left_txt"><label>
                                <input name="fwzx" type="text" id="fwzx" size="10" value="<?=$fwzx?>">
                              <span class="red">*</span></td>
                            </tr>
					<?
				 }
				 ?>
				    <tr>
				      <td height="30" align="center" class="left_txt">身份证</td>
				      <td height="30" class="left_txt"><label>
				        <input name="idcard" type="text" id="idcard">
				        <span class="red">*</span></label></td>
				      </tr>
				    <tr>
				     <td height="30" align="center" class="left_txt">QQ</td>
				     <td height="30" class="left_txt"><label>
				       <input name="qq" type="text" id="qq">
				     </label></td>
				     </tr>
				   <tr>
				     <td height="30" align="center" bgcolor="#f2f2f2" class="left_txt">E-mail</td>
				     <td height="30" bgcolor="#f2f2f2" class="left_txt"><label>
				       <input name="email" type="text" id="email">
				     </label></td>
				     </tr>
				   <tr>
				     <td height="30" align="center" class="left_txt">手机</td>
				     <td height="30" class="left_txt"><label>
				       <input name="mobile" type="text" id="mobile">
				     </label></td>
				     </tr>
				   <tr style="display:">
				     <td height="30" align="center" bgcolor="#f2f2f2" class="left_txt">收货地址</td>
				     <td height="30" bgcolor="#f2f2f2" class="left_txt"><label>
				       <input name="address" type="text" id="address" size="50">
				     </label></td>
				     </tr>
				   <tr style="display:">
				     <td height="30" align="center" class="left_txt">所在地区</td>
				     <td height="30" class="left_txt">
				     <select name="province" id="province" onChange="provincechange(this.value)" style="width:140px;">
					   <option value="">请选择</option>
					   <?
					   $sqlsf="select * from {$db_prefix}province where 1";
					   $resultsf=$db->query($sqlsf);
					   while($rssf=$db->fetch_array($resultsf)){
					   	echo "<option value='{$rssf['provinceID']}'>{$rssf['province']}</option>";
					   }
					   $db->free_result($resultsf);
					   ?>
				         </select> 
						
				      城市/City： <select name="city" id="city" onChange="citychange(this.value)" style="width:160px;">
				         </select> 
						 
				      区县/Counties： <select name="area" id="area" style="width:160px;">
				         </select>
				      <span class="red">*</span><br> 
				      <label id="province_notice" class="red"></label></td>
				     </tr>
				   <tr>
				     <td height="30" align="center" bgcolor="#f2f2f2" class="left_txt">开户银行</td>
				     <td height="30" bgcolor="#f2f2f2" class="left_txt"><label>
				       <select name="bank" id="bank">
					   <option value="">请选择/Please select</option>
					   <?
					   $sqlyh="select * from {$db_prefix}banks where 1";
					   $resultyh=$db->query($sqlyh);
					   while($rsyh=$db->fetch_array($resultyh)){
					   	echo "<option value='{$rsyh['bank']}'>{$rsyh['bank']}</option>";
					   }
					   $db->free_result($resultyh);
					   ?>
				         </select>
				     </label>
				     <label class="red" id="bank_notice">*</label></td>
				     </tr>
				   <tr>
				     <td height="30" align="center" class="left_txt">银行地址</td>
				     <td height="30" class="left_txt"><label>
				       <input name="bankaddress" type="text" id="bankaddress" size="40">
				       <span class="red">*</span></label></td>
				     </tr>
				   <tr>
				     <td height="30" align="center" bgcolor="#f2f2f2" class="left_txt">银行卡号</td>
				     <td height="30" bgcolor="#f2f2f2" class="left_txt"><label>
				       <input name="bankno" type="text" id="bankno">
				       <span class="red">*</span></label></td>
				     </tr>
				   <tr>
				     <td height="30" align="center" class="left_txt">卡号开户名</td>
				     <td height="30" class="left_txt"><label>
				       <input name="bankname" type="text" id="bankname">
				       <span class="red">*</span></label></td>
				     </tr>
				   <tr style="display">
                  <td height="30" align="center" bgcolor="#f2f2f2" class="left_txt"><label><input name="agree" type="checkbox" id="agree" value="1" checked="checked"> <a href="user_regxy.php" target="_blank">同意注册协议</a></label>   <span class="red">*</span></td>
					<td><div style="width:400px; height:200px; overflow:scroll">
					<?
					//获取协议
					$sqlxy="select * from {$db_prefix}xieyi where 1";
					$rsxy=$db->get_one($sqlxy);
					echo stripslashes($rsxy['content']);
					?>
					</div>	
					
					</td>
                </tr>
              </table></td>
            </tr>
            
            <tr>
              <td height="30" colspan="3" align="center"><label id="reg_notice" class="red"></label></td>
            </tr>
            <tr>
              <td width="50%" height="30" align="right"><span class="left_txt">
                <input type="hidden" name="isdyhy" id="isdyhy" value="<?=$isdyhy?>">
                </span>
                <input type="submit" value="完成以上修改/Completed modifications" name="B1" onclick='return CommandConfirm();'/></td><td width="6%" height="30" align="right">&nbsp;</td>
              <td width="44%" height="30"><input type="reset" value="取消设置/Cancel the setting" name="B12" />
		 
<script>
function CommandConfirm(){
	var str1="会员名:";
	var str2="姓名:";
	var str3="推荐用户:";
	var str4="身份证号:";
	var str5="手机号码:";
	var username=document.getElementById("username").value; 
	var nickname=document.getElementById("nickname").value; 
	var tjuser=document.getElementById("tjuser").value; 
	var idcard=document.getElementById("idcard").value; 
	var mobile=document.getElementById("mobile").value; 
	var abc=' \n '+''+str1+''+username+''+' \n '+''+str2+''+nickname+''+' \n '+''+str3+''+tjuser+''+' \n '+''+str4+''+idcard+''+' \n '+''+str5+''+mobile+''+' \n ';
//	alert(abc); 
 if(window.confirm("您确定注册会员吗？\n"+abc+"")){
   return true;
 }else{
   return false;
 }
}
</script>
			  </td>
            </tr>
            <tr>
              <td height="30" colspan="3">&nbsp;</td>
            </tr>
          </table>
		  </form>
		  </td>
      </tr>
    </table></td>
    <td background="images/mail_rightbg.png">&nbsp;</td>
  </tr>
  <tr>
    <td valign="middle" background="images/mail_leftbg.png"><img src="images/buttom_left2.png" width="17" height="17" /></td>
      <td height="17" valign="top" background="images/buttom_bgs.png"><img src="images/buttom_bgs.png" width="17" height="17" /></td>
    <td background="images/mail_rightbg.png"><img src="images/buttom_right2.png" width="16" height="17" /></td>
  </tr>
</table>

</body>
</html>
